#pragma
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <termios.h>
#include <sys/time.h>
#include <signal.h>
#include <stdbool.h>
#include <memory.h>
extern int next_type;
extern int next_change_type;
extern int next_x;
extern int next_y;
extern int dynamic_x, dynamic_y;
extern int dynamic_type, dynamic_changeType;

extern int score_x; 
extern int score_y; 
extern int level_x; 
extern int level_y; 
extern int score;
extern int level;
extern int type, change_type,x,y,color;
extern int init_x;
extern int init_y;
extern int color;
extern int color_init;
extern int color_background;
extern int interval;
extern int matrix[24][28];
//extern struct termios tm_old;


void print_mode_shape(int n,int m,int x,int y,int c);//打印方块

void print_next_shape(int color);//打印下一个图形

void clear_block(int type,int change_type,int x,int y);//清除方块

void move_right(int type, int chageType, int color);//向右移
void move_left(int type, int chageType, int color);//向左移
int move_down(int type, int chageType, int color);//向下移动
void chageType(int x, int y, int color);//变换图形
void move_button(int dynamic_type,int dynamic_change_type,int glabal_color);//向下掉落方块


void store_cur_shape(int type, int change_type, int color);//存储当前图形到底部
bool check_collide(int type, int change_type, int x, int y);//检查碰撞
void init_new_shape(int color);//初始化下一个图形

int check_line_blank(int line);//检查空行
int check_game_over();//检查游戏是否结束
void game_over();//打印游戏退出信息

void print_score_level();
void alarm_us(int n);

void print_matrix();
void clear_full_row();
void recover_attr();